public class College {  
    private String name;  
    // 假设每个College有多个Building，使用List来表示  
    private List<Building> buildings;  
  
    // 构造函数  
    public College(String name) {  
        this.name = name;  
        this.buildings = new ArrayList<>();  
    }  
  
    // 添加Building到College中  
    public void addBuilding(Building building) {  
        this.buildings.add(building);  
    }  
  
    // Getter和Setter方法  
    public String getName() {  
        return name;  
    }  
  
    public void setName(String name) {  
        this.name = name;  
    }  
  
    public List<Building> getBuildings() {  
        return buildings;  
    }  
  
    public void setBuildings(List<Building> buildings) {  
        this.buildings = buildings;  
    }  
}  
  
// Building.java  
public class Building {  
    private String name;  
    // 由于Building是College的一部分，这里我们假设Building有一个对College的引用  
    private College college;  
  
    // 构造函数，注意这里我们传递了一个College对象来初始化  
    public Building(String name, College college) {  
        this.name = name;  
        this.college = college;  
      
    }  
  
    // Getter和Setter方法  
    public String getName() {  
        return name;  
    }  
  
    public void setName(String name) {  
        this.name = name;  
    }  
  
    public College getCollege() {  
        return college;  
    }  
  
。  
    public void setCollege(College college) {  
        this.college = college;  
    }  
}  
  
// Course.java  
public class Course {  
    private String name;  
    private Building building; // Course在某个Building中进行  
    private College college; // Course可能与某个College有关联（这里为了完整性而包含，但具体关系需根据UML图确定）  
  
    // 构造函数  
    public Course(String name, Building building) {  
        this.name = name;  
        this.building = building;  
        // 假设Course的College与Building的College相同（这只是一个假设）  
        this.college = building.getCollege();  
    }  
  
    // Getter和Setter方法  
    public String getName() {  
        return name;  
    }  
  
    public void setName(String name) {  
        this.name = name;  
    }  
  
    public Building getBuilding() {  
        return building;  
    }  
  
    public void setBuilding(Building building) {  
        this.building = building;  
        // 更新Course的College（如果需要的话）  
        this.college = building.getCollege();  
    }  
  
    public College getCollege() {  
        return college;  
    }  